﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
    class Dbhelper
    {
        public static string comString = "server=.;database=SSDA;;uid=sa;pwd=Class";
        public static DataTable GetDataTable(string sql)
        {
           

            SqlConnection connection = new SqlConnection(comString);
            SqlDataAdapter adapter = new SqlDataAdapter(sqlString, connection);
            connection.Open();
            DataTable dt = new DataTable();
            adapter.Fill(dt);
            return dt;
        }
        public static int Add(string sql )
        {
            SqlConnection connection = new SqlConnection(comString);
            SqlCommand sqlCommand = new SqlCommand(sql,connection);
            connection.Open();
            return sqlCommand.ExecuteNonQuery();
        }
    }
}
